<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCouponType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon_types', function (Blueprint $table) {
            $table->id();
            $table->string('code',20)->uniqid();
            $table->string('name');
            $table->smallInteger('mode'); // 1: 服务兑换券 2: 现金券
            $table->integer('product_id')->default(0); // 1: 对应的产品ID
            $table->float('money', 8, 2)->default(0); // 2： 现金券对应的价值 
            $table->float('price', 8, 2); // 对应的价格 
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon_types');
    }
}
